﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MovieRental_Presentation.DataViews;
using MovieRental_Presentation.Helpers;
using MovieRental.EnhancedEntities;

namespace MovieRental_Presentation
{
	public partial class LoanDialog
	{
        private CartDataView _cartDataView;

		public LoanDialog()
		{
			this.InitializeComponent();
            _cartDataView = (App.Current as App).CartDataView;
            DataContext = _cartDataView;
			// Insert code required on object creation below this point.
		}

		private void backButton_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// TODO: Add event handler implementation here.
			this.NavigationService.GoBack();
		}

        private void acceptButton_Click(object sender, RoutedEventArgs e)
        {
            ComponentManager.Instance.LoanCartComponent.AddOrUpdate(_cartDataView.CurrentCart.Entity);
            _cartDataView.CurrentCart = new LoanCart();
            NavigationService.GoBack();
        }
	}
}